Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prometheus_flask_exporter #233

Merged
merged 1 commit into from
Oct 2, 2024
Merged

add prometheus_flask_exporter #233

merged 1 commit into from
Oct 2, 2024

Conversation

charlienegri
Copy link
Contributor

Summary: extract metrics via prometheus_flask_exporter

Related issue:
#220

Suggested reviewer(s):

Reviewer checklist:

  • The headers of all files contain a reference to the repository license
  • 100% test coverage of new code - meaning:
    • The overall test coverage increased or remained the same as before
    • Every function is accompanied with a test suite
    • Tests are both positive (testing that the function work as intended with valid data) and negative (testing that the function behaves as expected with invalid data, e.g., that correct exceptions are thrown)
    • Functions with optional arguments have separate tests for all options
  • Examples are supported by doctests
  • All tests are passing
  • All names (e.g., files, classes, functions, variables) are explicit
  • Documentation (as docstrings) is complete and understandable

The checklist is based on the S-ENDA conventions and definition of done (see General Conventions). The above points are not necessarily relevant to all contributions. In that case, please add a short explanation to help the reviewer.

@charlienegri
Copy link
Contributor Author

charlienegri commented Oct 1, 2024

Screenshot from 2024-10-01 15-04-28
local test seems to expose the metrics at least

@charlienegri
Copy link
Contributor Author

charlienegri commented Oct 1, 2024

@magnarem this should not conflict with the catalog-rebuilder-flask metrics endpoint right? because dmci has its own container port (8000) as far as I understand, and that's where these /metrics will end up

@magnarem
Copy link
Contributor

magnarem commented Oct 2, 2024

I think it should be no problem. The k8s nginx in front of dmci, should handle request dmci.s-enda.k8s.met.no/metrics og catalog-rebuilder.s-enda.k8s.met.no/metrics to the right ones...If unsure, maybe the k8s people can give a better answer.

@charlienegri charlienegri marked this pull request as ready for review October 2, 2024 09:27
@charlienegri
Copy link
Contributor Author

charlienegri commented Oct 2, 2024

Screenshot from 2024-10-02 11-49-19
the path label can be used to discriminate the endpoint

Copy link
Contributor

@magnarem magnarem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Let's see if it works.

Copy link
Contributor

@magnarem magnarem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see if it works in dev

@charlienegri charlienegri merged commit a7fd34b into main Oct 2, 2024
5 checks passed
@charlienegri charlienegri deleted the issue_220 branch October 2, 2024 10:17
@charlienegri
Copy link
Contributor Author

I think we'll need to add annotations to the base/dmci/statefulset.yaml in the tjeneste repo for the metrics to be actually scraped, as there are for catalog-rebuilder-flask, basically identical lines but just with a changed port, should be 8000 if I read the code right

@magnarem
Copy link
Contributor

magnarem commented Oct 2, 2024

Yes, for promethues to see the metrics, you will have to add the right anotations.

The dmci pod did not start properly.

Here is the error from the dmci startup log:

ModuleNotFoundError: No module named 'prometheus_flask_exporter'

You will need to add the prometheus_flask_exporter dependency to the setup.cfg for the installer to install this module.

Add it under: install_requires =

@charlienegri
Copy link
Contributor Author

🙃 I added it to the requirements file and forgot about that ... I will open a PR to fix this

@charlienegri
Copy link
Contributor Author

patch #234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants